package de.bomzhi.mz.pflection.model;

import java.util.HashSet;
import java.util.Set;

import com.powerflasher.fdt.core.outermodel.IOuterModelElement;


public class SetOfStrongTypedModels<T extends IOuterModelElement> {
	private Set<T> models = new HashSet<T>();
	private final String description;
	private int index = -1;
	
	public void setIndex(int index) {
		this.index = index;
	}

	public SetOfStrongTypedModels(String string) {
		this.description = string;
	}

	public void add(T element) {
		models.add(element);
	}
	
	public Set<T> getModels() {
		return models;
	}
	
	public T getFirst() {
		return models.iterator().next();
	}
	
	public int getSize(){
		return models.size();
	}
	
	public String getDescription() {
		if(index>-1){
			return index + " " + description + ": " + getSize();
		}else{
			return description + ": " + getSize();
			
		}
	}
	
	@Override
	public String toString() {
		String indexString;
		if(index<10){
			indexString = "00"+index;
		}
		else if(index<100){
			indexString = "0"+index;
		}else{
			indexString = ""+index;
		}
		return indexString + " " + description;
	}
}
